;;;; Copyright 2009 Peter von Etter

;;;; This file is part of Autoproject

;;;; Autoproject is free software: you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation, either
;;;; version 3 of the License, or (at your option) any later version.
;;;;
;;;; Autoproject is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;;;; Lesser General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with Autoproject.  If not, see
;;;; <http://www.gnu.org/licenses/>.

;;;; Implementation specific parts go here.

(in-package :autoproject)

;;;; SBCL 

#+sbcl
(defun run-program (program-name args)
  (sb-ext:run-program program-name args
                      :search t
                      :output t))

#+sbcl
(defun save-lisp-and-die (core-name)
  (sb-ext:save-lisp-and-die core-name))

#+sbcl
(defun make-lisp-shell-command (&key core eval batch)
  (let ((*package* (find-package :cl-user)))
    (format nil "sbcl~A --noinform --end-runtime-options~A~A"
            (if core
                (format nil " --core ~A" core)
                "")
            (if batch
                " --disable-debugger"
                "")
            (if eval
                (format nil "~{ --eval ~S~}" 
                        (mapcar 'prin1-to-string eval))
                ""))))
#+sbcl 
(defun quit (&optional (status 0))
  (sb-ext:quit :unix-status status))

;;;; CMUCL                                                                                                  
                                                                               
#+cmu
(defun run-program (program-name args)
  (ext:run-program "/bin/sh" 
                   (list "-c" (format nil "~A~{ ~A~}" 
                                      program-name args))
                   :output t))

#+cmu
(defun save-lisp-and-die (core-name)
  (ext:save-lisp core-name))

#+cmu
(defun make-lisp-shell-command (&key core eval batch)
  (let ((*package* (find-package :cl-user)))
    (format nil "lisp~A -quiet~A~A"
            (if core
                (format nil " -core ~A" core)
                "")
            (if batch
                " -batch"
                "")
            (if eval
                (format nil "~{ -eval ~S~}"
                        (mapcar 'prin1-to-string eval))
                ""))))
#+cmu
(defun quit (&optional (status 0))
  (unix:unix-exit status))


;;;; CLISP

;;;; CCL

;;;; LW

;;;; ACL

;;;; ...